#pragma once

#include "Object/Object.h"
#include "EditorSideBarActiveBarPosition.h"
#include "EditorSideBarViewModel.m.h"

class REditorSideBarModel;
class REditorAbilityViewModel;
class RTexture2D;

//侧边栏，包含一个激活栏和一组功能
//主侧边栏的激活栏以在这个类内部，也可以在外部(默认情况)
RCLASS(ExtraHeader="Ability/EditorAbilityViewModel.h")
class REditorSideBarViewModel : public RObject
{
    ROBJECT

public:
    void BindModel(TSharedObjectPtr<REditorSideBarModel> InModel);

    const float TitleHeight = 35;
    const float TabSize = 35;
    const float IconImageSize=20;
    int64_t HoveredAbilityIndex = -1;
    void OnAbilityClicked(int64_t InIndex);
    bool IsAbilityHighlight(int64_t InIndex) const;
    bool IsAbilityVisible(int64_t InIndex) const;
    int64_t GetAbilitysNum() const;
    //获取功能图标,自动选择高亮
    TSharedObjectPtr<RTexture2D> GetAbilityIcon(int64_t InIndex) const;
    CString GetAbilityTitle(int64_t InIndex)const;
    TSharedObjectPtr<REditorAbilityViewModel> GetAbility(int64_t Index) const; 
    TDelegate<void,int64_t,TSharedObjectPtr<REditorAbilityViewModel>> OnAbilityAdded;
    TDelegate<void,int64_t> OnAbilityRemoved;

    EEditorAbilityActiveBarPositionType GetActiveBarPosition() const;
protected:
    TWeakObjectPtr<REditorSideBarModel> Model;

    RFIELD()
    TVector<TSharedObjectPtr<REditorAbilityViewModel>> Abilitys;


};
